Skip to main content

Google Sign-in

Type

library

Summary

This library provides access to Google Sign-In functionality on Android.

Description

Use this library to allow users to sign in with Google in your Android app, and to retrieve information about the signed-in user's Google account.

Setting up Google Sign-in

A number of steps are required in order to add Google Sign-in functionality to your app. Firstly a Google developer account is needed, which can be created here. Once you have a Google developer account, the next step is to create a new project in the Google API Console. Once your project is created, you can configure the project, specifying the app id you will use for the app as well as adding the SHA1 of your signing certificate. You can find the SHA1 by running

keytool -list -v -alias androiddebugkey -keystore ~.android\debug.keystore

or equivalent in a terminal.

Your app must be signed in order to work with Google Sign-In. You can create a keystore for signing Android apps by following the lesson here

Compatibility and Support

OS

android

Associated Syntax

Handler

NameSummarySyntax
googleGetSignInDisplayNameGet the display name of the authenticated usergoogleGetSignInDisplayName()
googleGetSignInIdGet the unique ID for the signed in Google accountgoogleGetSignInId()
googleGetSignInPhotoURLGet the URL of the profile picture of the authenticated usergoogleGetSignInPhotoURL()
googleSignInInitiate the Google Sign-In processgoogleSignIn(<pOptions>)
googleGetSignInServerAuthCodeGet an ID token that you can send to your servergoogleGetSignInServerAuthCode()
googleGetSignInEmailGet the email address of the authenticated usergoogleGetSignInEmail()
googleSignInRequiredFind out if a user is already authenticatedgoogleSignInRequired()
googleGetSignInFamilyNameGet the family name of the authenticated usergoogleGetSignInFamilyName()
googleGetSignInGivenNameGet the given name of the authenticated usergoogleGetSignInGivenName()
googleSignOutLogout the currently authenticated usergoogleSignOut()
googleGetSignInIdTokenReturns an ID token that you can send to your servergoogleGetSignInIdToken()

Message

NameSummarySyntax
googleSignInResponseSent to the caller when the Google Sign-In attempt is complete.googleSignInResponse <pSuccess>